/*-------------------------------------
		sPlugin
	    By Scooby, 2010
-------------------------------------*/

local PLUGIN = {}

PLUGIN.Name = "Set Group"
PLUGIN.Author = "Scooby"
PLUGIN.Command = "setgroup"
PLUGIN.Group = 0
PLUGIN.Use = "<Player> <Group>"
PLUGIN.Format = "string string"
PLUGIN.Menu = {
	{
		["#title"] = "Select Player",
		["#cont"] = "#players"
	},
	{
		["#title"] = "Select Group",
		["#cont"] = "#groups"
	}
}


function PLUGIN:Main( ply, args )
	
	local plys = spl:FindPly( args[1] )
	
	if( #plys > 1 ) then
		spl:PrintC( ply, spl.red, "More Than One Player Found!" )
		return false
		
	elseif( #plys == 0 ) then
		spl:PrintC( spl, spl.red, "No Players Found" )
		return false
		
	end
	
	if not( ply:CanSplDo( plys[1] ) ) then
		
			spl:PrintC( ply, spl.red, "Sorry You Cannot Target This Person!" )
			return false
		
	end
		
	plys[1]:SetSplGroup( args[2], ply )
	
end

spl:AddPlugin( PLUGIN )